function $(eleStr){
    switch(eleStr.substr(0,1)){
    case "#":
        return document.getElementById(eleStr.substr(1));
        break;
    case ".":
        return document.getElementsByClassName(eleStr.substr(1));
        break;
    case "_":
        return document.getElementsByName(eleStr.substr(1));
        break;
    default:
        return document.getElementsByTagName(eleStr);
    break;
    }
}
onload = function(){

    doOperator();       
}
   function doOperator(){

        var dels =$(".btn1");
        for (var i = 1; i < dels.length; i++) {
            dels[i].onclick =   function(){
                if(confirm("是否确定删除？")){  //提示是否删除
                    //var row = this.parentNode.parentNode; //取到tr对象
                    //row.parentNode.removeChild(row);  //移除tr
                    $("#stuRecordTable").deleteRow(this.parentNode.parentNode.rowIndex);
                }
            }
        }
    }
    // 添加函数
    function addRow(){
        var rs = $("#stuRecordTable").rows;  //table取到所有的行
        var insertR = $("#stuRecordTable").insertRow(rs.length1); //给表格添加一行(不包单元格)
        //insertR.innerHTML = rs[1].innerHTML;    
        var c1 = insertR.insertCell(0);       
        c1.innerHTML = '<input type="checkbox"/>';
        var c2 = insertR.insertCell(1);
        c2.innerHTML = "";
        var c3 = insertR.insertCell(2);
        c3.innerHTML = "";
        var c4 = insertR.insertCell(3);
        c3.innerHTML = "";
        var c4 = insertR.insertCell(4);
        c3.innerHTML = "";
        var c4 = insertR.insertCell(5);
        c3.innerHTML = "";
        var c4 = insertR.insertCell(6);
        c3.innerHTML = "";
        var c5 = insertR.insertCell(7);
        c5.innerHTML ='<input type="button" value="删除" class="btn1"/> <input type="button" value="修改" class="btn2"/>';
        doOperator();
        var cs = rs[1].cells; //取到当前行的所有单元格
        //alert(cs[1].innerHTML);
    }
